Fix emulated writable pagetable updates where access is
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 18 Aug 2005 18:02:46 +0000 (18:02 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 18 Aug 2005 18:02:46 +0000 (18:02 +0000)
less than a full pte and operation requires cmpxchg.

Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/mm.c

index 70f58806c877ef2031048f8d527acd677b45ef61..08a6a15dcbee5304a73da2c04429c348758f458f 100644 (file)
@@ -3059,7 +3059,7 @@ static int ptwr_emulated_update(
     }
 
     /* Turn a sub-word access into a full-word access. */
-    if (bytes != sizeof(physaddr_t))
+    if ( bytes != sizeof(physaddr_t) )
     {
         int           rc;
         physaddr_t    full;
@@ -3076,6 +3076,10 @@ static int ptwr_emulated_update(
         val  &= (((physaddr_t)1 << (bytes*8)) - 1);
         val <<= (offset)*8;
         val  |= full;
+        /* Also fill in missing parts of the cmpxchg old value. */
+        old  &= (((physaddr_t)1 << (bytes*8)) - 1);
+        old <<= (offset)*8;
+        old  |= full;
     }
 
     /* Read the PTE that maps the page being updated. */